<?php
class video_model extends CI_Model
{
	function __construct()
	{
		parent::__construct();
	}
	function getProduct($id)
	{
		
		$query=$this->db->get_where('video',array('id'=>$id));
		return $query->result();
	}
	function getByCategories($id,$offset,$itemperpage)
	{
		$this->db->limit($itemperpage,$offset);
		//$query=$this->db->query('select * from product where idcategories='.$id);
		$query=$this->db->get_where('video',array('id_manufacturer'=>$id));
		return $query;
	}
	function getNewProduct($offset,$itemperpage)
	{
		$this->db->order_by('date',"DESC");
		$this->db->limit($itemperpage,$offset);
		$query=$this->db->get('video');
		return $query;
	}
	function getAll($offset,$itemperpage)
	{
		$this->db->limit($itemperpage,$offset);
		$this->db->order_by('id','desc');
		$query=$this->db->get('video');
		return $query;
	}
	function delete($id)
	{
		$this->db->where('id',$id);
		$this->db->delete('video');
	}
	function addproduct($arr)
	{
		$this->db->insert('video',$arr);
	}
	function update($arr)
	{
		$this->db->where('id',$arr['id']);
		$this->db->update('video',$arr);
	}
	function getAllProduct($offset,$itemPerpage)
	{
		$this->db->limit($itemPerpage,$offset);
		return $this->db->get('video');
	}
	function getListProduct(){
		$query = $this->db->get('video');
		return $query->result();
	}
}